package com.mijie.homi.search.util;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;


public class mapUtil {
	

 

	public static void save2file(Map<String, String> mp, String target,
			String encode) {
		List<String> li=new ArrayList<String>();
		Set<String> key = mp.keySet();
		for (Iterator it = key.iterator(); it.hasNext();) {
			String key_single = (String) it.next();
			String value = mp.get(key_single);
			String line=key_single+"\t"+value;
			li.add(line);
		}
		fileC0 fc=new fileC0();
		fc.saveList2file(li, target, encode);
		
	}
	
	//　//比较复杂的一种遍历在这里，呵呵~~他很暴力哦，它的灵活性太强了，想得到什么就能得到什么~~
    public static void workByEntry(Map<String, String> map) {
        Set<Map.Entry<String, String>> set = map.entrySet();
        for (Iterator<Map.Entry<String, String>> it = set.iterator(); it.hasNext();) {
            Map.Entry<String, String> entry = (Map.Entry<String, String>) it.next();
            System.out.println(entry.getKey() + "--->" + entry.getValue());
        }
    }

}
